package com.xjzd.std.trywithresource;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class TryWithResource {

    public static void test(InputStream is) throws IOException {
        byte[] bytes = is.readAllBytes();
        System.out.println(new String(bytes));
    }

    public static void main(String[] args) {
        try (InputStream fi = new FileInputStream(".gitignore")) {
            test(fi);
        } catch (IOException e) {
            System.out.println(e.getMessage());
        }
    }
}
